//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
/*
 * usb_serial.h: USB Serial utilities for blob (Modified by Alek.du@intel.com)
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#ident "$Id: serial_usb.h,v 1.1 2006/07/13 08:10:59 zhangyi Exp $"

#ifndef BLOB_USB_SERIAL_H
#define BLOB_USB_SERIAL_H

//#include <blob/types.h>

typedef int (*usb_serial_init_func_t)(void);
typedef int (*usb_serial_read_func_t)(char*,int);
typedef int (*usb_serial_write_func_t)(const char*,int);
typedef int (*usb_serial_poll_func_t)(void);

typedef struct
{
    usb_serial_init_func_t init;
    usb_serial_read_func_t read;
    usb_serial_write_func_t write;
} usb_serial_driver_t;

/* implemented serial drivers */
extern usb_serial_driver_t bvd_usb_serial_driver;

/* should be filled out by the architecture dependent files */
extern usb_serial_driver_t *usb_serial_driver;

/* exported functions */
int usb_serial_init(void);
#define usb_serial_read  usb_serial_rx
#define usb_serial_write usb_serial_tx

#if 0 /* Nam9, 2004. 9. 3 */
int usb_serial_read(char *,int);
int usb_serial_write(const char*,int);
#else
int usb_serial_rx(char *,int);
int usb_serial_tx(const char*,int);
#endif

/* Nam9, 2004. 9. 3 */
void usb_driver_reset(void);

#endif
